import 'package:flutter/material.dart';
import 'package:lai_zhan/widget/BaseScaffold.dart';
import 'package:lai_zhan/common/util/NavigatorUtil.dart';
import 'package:photo_view/photo_view.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:lai_zhan/common/style/AppStyle.dart';

class PhotoPreViewPage extends StatefulWidget {

  String imageUrl;


  PhotoPreViewPage({this.imageUrl});

  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return new _PhotoPreViewPageState(imageUrl);
  }
}

class _PhotoPreViewPageState extends State<PhotoPreViewPage> {

  String imageUrl;


  _PhotoPreViewPageState(this.imageUrl);

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return new Scaffold(
      appBar: new AppBar(leading: new IconButton(icon: Icon(Icons.arrow_back,size: 40,), onPressed:((){
        NavigatorUtil.goBack(context);
        })),
        backgroundColor: Color(AppColors.primaryColor),
      ),
      body: new Container(
        color: Colors.black,
        child: new PhotoView(
          imageProvider: new NetworkImage(imageUrl),
          loadingChild: Container(
            child: new Stack(
              children: <Widget>[
                new Center(child: new SpinKitFoldingCube(color: Colors.white30, size: 60.0)),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
